name: "File Chat"
slug: "file-chatbot"
icon: "tool"
category_slugs: ["productivity", "programming", "finance"]
description: 'Build you own "Chat with File" app that let''s you upload any PDF, RTF, TXT, DOCX, PPTX files and ask questions on their contents.'
provider_slug: "promptly"
pages:
  - title: "Chatbot configuration"
    description: "Configure your file chatbot"
    input_fields:
      - name: "header_message"
        title: "Header"
        type: "string"
        widget: "richtext"
        description: "Content to show at the top of the chat window"
        path: "config.input_template"
      - name: "welcome_message"
        title: "Welcome Message"
        type: "string"
        description: "This is the message the chatbot greets user with"
        path: "config.welcome_message"
      - name: "assistant_image"
        title: "Chatbot Image"
        type: "image"
        description: "Avatar to use for your chatbot"
        path: "config.assistant_image"
      - name: "question_description"
        title: "Question help text"
        type: "string"
        description: "Help text to show below the question input box"
        path: "input_fields[1].description"
app:
  name: "File Chatbot"
  slug: "file-chatbot"
  description: "File Chatbot"
  type_slug: "text-chat"
  input_fields:
    - name: "file"
      title: "File"
      type: "file"
      description: "Drop here the file you want to ask questions on"
    - name: "question"
      title: "Question"
      type: "string"
      description: "Enter your question here"
  output_template:
    markdown: |
      {{_inputs2.choices[0].content}}
  processors:
    - id: "_inputs1"
      provider_slug: "promptly"
      processor_slug: "data_uri_text_extract"
      input:
        {
          "file": "",
          "query": "{{_inputs0.question}} ",
          "file_data": "{{_inputs0.file}} ",
        }
      config: { "document_limit": 2, "text_chunk_size": 1500 }
    - id: "_inputs2"
      provider_slug: "openai"
      processor_slug: "chatgpt"
      input:
        {
          "messages":
            [
              {
                "name": "",
                "role": "user",
                "content": "Context: {{_inputs1.text}} \n\n---\n\nQuestion: {{_inputs0.question}} ",
                "function_call": { "arguments": "" },
              },
            ],
          "chat_history": [],
          "system_message": "You are a helpful AI assistant that answers user's question based on the provided context",
        }
      config:
        {
          "n": 1,
          "model": "gpt-3.5-turbo",
          "top_p": 1,
          "stream": true,
          "max_tokens": 1024,
          "temperature": 0.7,
          "retain_history": false,
          "presence_penalty": 0,
          "frequency_penalty": 0,
          "auto_prune_chat_history": false,
        }
